<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="home" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>日志管理</title>
<jsp:include page="../../../common/common.jsp"></jsp:include>
</head>
<body>

	<form class="layui-form" style="padding: 15px 15px">
		<div class="layui-input-inline">
			<input type="text" name="logUser" autocomplete="off" placeholder="操作人"
				class="layui-input" lay-verify="required">
		</div>
		<div class="layui-input-inline">
			<input type="text" name="createTime" autocomplete="off" placeholder="操作时间"
				class="layui-input" lay-verify="required" id="time">
		</div>
		<div class="layui-input-inline " style="width: 90px">
			<button class="layui-btn" id="searchEmailCompany" data-type="reload"
				lay-submit lay-filter="smt">
				<i class="layui-icon" style="font-size: 20px;"></i> 搜索
			</button>
		</div>
	</form>

	<table id="demo" lay-filter="opt"></table>
	
	<script>
	
	layui.use([ 'table', 'layer', 'jquery', 'element', 'form','laydate' ],function() {
		var table = layui.table;
		var layer = layui.layer;
		var jquery = layui.jquery;
		var element = layui.element;
		var form = layui.form;
		var laydate = layui.laydate;
		
		//执行一个laydate实例
	  	laydate.render({
	    	elem: '#time' //指定元素
	  	});
		
		form.render();
		
		//第一个实例
		table.render({
				elem : '#demo',
				height : 550,
				page : true,
				url : '${home}/api/admin/sys/log/logList.do' //数据接口
				,
				request : {
					pageName : 'pageNum' //页码的参数名称，默认：page
					,
					limitName : 'pageSize' //每页数据量的参数名，默认：limit
				},
				cols : [ [ //表头
				{
					field : 'logId',
					title : 'ID',
					sort : true,
					fixed : 'left',
					align : 'center'
				}, {
					field : 'logUser',
					title : '操作人',
					sort : true,
					align : 'center'
				}, {
					field : 'createTime',
					title : '操作时间',
					sort : true,
					align : 'center'
				}, {
					field : 'logDesc',
					title : '操作描述',
					sort : true,
					align : 'center'
				},] ],
				limit : 10
		});
		
		
		//监听表单提交事件
		form.on('submit(smt)',function(data) {
		    console.log(data.field)
		    //执行重载
		    table.reload('demo', {
		        url: '${home}/api/admin/sys/log/logList.do',
		        page: {
		            curr: 1
		            //重新从第 1 页开始
		        },
		        where: {
		        	logUser: $('[name="logUser"]').val(),
		        	createTime: $('[name="createTime"]').val()
		        }
		    });
			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
				    
		});
		
	});
	
	</script>
	
</body>
</html>